#include <windows.h>
#include <d3d10.h>
#include <d3dx10.h>

#include <vector>
#include "sceneNode.h"
#include "sceneLight.h"
#include "sceneCamera.h"

using namespace std;

class sceneGraph {

private:

	//containers
	vector<sceneLight>		lights;
	vector<sceneNode>		frames;

	//camera
	sceneCamera				camera;

	int getIndex(string n);
	void drawFrame(	sceneNode* tFrame,
					D3DXMATRIX parentMatrix,
					ID3D10EffectMatrixVariable* pWorldMatrixEffectVariable,
					ID3D10EffectMatrixVariable* pWorldMatrixITVariable,
					ID3D10EffectTechnique* pBasicTechnique,
					D3D10_TECHNIQUE_DESC techDesc);

public:

	sceneGraph();

	vector<sceneNode>*		getFrames();

	sceneNode*	addFrame(sceneNode f);		//adds frame, returns pointer to the frame
	sceneNode*	createFrame(string n);
	sceneNode*	getFrame(int n);				//returns frame at the given index
	sceneNode*	getFrame(string n);
	sceneNode*	getScene();					//returns frame with index 0
	sceneNode*	getParent(sceneNode* f);		//returns parent of the referenced frame
	sceneNode*	getParent(int n);
	void		assignToRoot(string n);

	void		removeFrame(int n);
	//void		removeFrame(sceneNode* f);
	void		removeFrame(string n);

	void clear();

	bool exists(string n);
	void setCornellSize();
	void cleanup();

	void draw(	ID3D10EffectMatrixVariable* pWorldMatrixEffectVariable,
				ID3D10EffectMatrixVariable* pWorldMatrixITVariable,
				ID3D10EffectTechnique* pBasicTechnique,
				D3D10_TECHNIQUE_DESC techDesc);

	void addLight(sceneLight l);
	sceneLight* getLight(string name);
	void removeLight(string name);

	//camera methods
	sceneCamera* getCamera();


};